<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="edu.chiansoft.javabean.People" %>
<%@page import="java.util.*" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
Map<String,String> stringForMap=new HashMap<String,String>();
stringForMap.put("01", "1");
stringForMap.put("02", "3");
stringForMap.put("03", "6");

Map<String,People> peopleForMap=new  HashMap<String,People>();
peopleForMap.put("p1", new People(1,"fly01",1));
peopleForMap.put("p2", new People(2,"fly02",2));
peopleForMap.put("p3", new People(2,"fly03",3));
pageContext.setAttribute("key01", stringForMap);
pageContext.setAttribute("key02", peopleForMap);

%>
<h3>域里value的类型为map</h3>
<h4>获取Map容器里某个key的value</h4>
${key01['02'] }<br>
name:${key02['p3'].name };id:${key02['p3'].id };age:${key02['p3'].age }<br>
<hr>
<h3>获取Map容器里所有元素</h3>
<c:forEach var="element01" items="${key01 }">${element01.key }----${element01.value }<br>
</c:forEach>
<hr>
<c:forEach var="element02" items="${key02 }">${element02.key }<br>
&nbsp;&nbsp;&nbsp; id:${element02.value.id };name:${element02.value.name };age:${element02.value.age }<br>

</c:forEach>
</body>
</html>